﻿namespace AgileBoard.Infrastructure.Data.Repositories
{
    using System.Collections;
    using Domain;
    using Domain.DataInterfaces;
    using SharpArch.Data.NHibernate;

    public class ProjectRepository : Repository<Project>, IProjectRepository
    {
        #region IProjectRepository Members

        public Project FindByName(string projectName)
        {
            IList project = Session.CreateQuery("from Project where Name = :projectName")
                .SetParameter("projectName", projectName)
                .List();

            if (project != null && project.Count > 0)
                return project[0] as Project;

            return null;
        }

        #endregion
    }
}